package com.gong.yuanma.jucdemo;

import java.util.concurrent.CountDownLatch;

/**
 * @author GongChang
 * @version 1.0
 * @date 2021/6/14 0014 15:15
 */
public class CountDownLatchDemo {

    public static void main(String[] args) throws InterruptedException {
        CountDownLatch countDownLatch = new CountDownLatch(6);

        for (int i = 0; i < 6; i++) {
            new Thread(()->{
                System.out.println(Thread.currentThread().getName());
                countDownLatch.countDown();
            },String.valueOf(i)).start();
        }

        countDownLatch.await();

        System.out.println("main end");
    }
}
